-
Notifications
You must be signed in to change notification settings - Fork 27
unbxdSearch.js(fix): exclude upper bound in range facets #42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
0df66f1
to
0bd4a80
Compare
0bd4a80
to
8876698
Compare
var rangeFacet = processedParams.ranges[rangeField]; | ||
expect(rangeFacet.hasOwnProperty(start + ' TO ' + end)).to.be.true; | ||
expect(rangeFacet[start + ' TO ' + end]['lb']).to.equal(start); | ||
expect(rangeFacet[start + ' TO ' + end]['ub']).to.equal(end); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
['ub'] is better written in dot notation.
var rangeFacet = processedParams.ranges[rangeField]; | ||
expect(rangeFacet.hasOwnProperty(start + ' TO ' + end)).to.be.true; | ||
expect(rangeFacet[start + ' TO ' + end]['lb']).to.equal(start); | ||
expect(rangeFacet[start + ' TO ' + end]['ub']).to.equal(end); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
['ub'] is better written in dot notation.
|
||
var rangeFacet = processedParams.ranges[rangeField]; | ||
expect(rangeFacet.hasOwnProperty(start + ' TO ' + end)).to.be.true; | ||
expect(rangeFacet[start + ' TO ' + end]['lb']).to.equal(start); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
['lb'] is better written in dot notation.
|
||
var rangeFacet = processedParams.ranges[rangeField]; | ||
expect(rangeFacet.hasOwnProperty(start + ' TO ' + end)).to.be.true; | ||
expect(rangeFacet[start + ' TO ' + end]['lb']).to.equal(start); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
['lb'] is better written in dot notation.
var rangeField = 'price_fq'; | ||
var start = 5; | ||
var end = 10; | ||
var filter = rangeField + ":[" + start + " TO " + end + "}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mixed double and single quotes.
var rangeField = 'price_fq'; | ||
var start = 5; | ||
var end = 10; | ||
var filter = rangeField + ":[" + start + " TO " + end + "}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mixed double and single quotes.
var rangeFacet = this.searchobj.params.ranges[rangeField]; | ||
expect(rangeFacet.hasOwnProperty(start + ' TO ' + end)).to.be.true; | ||
expect(rangeFacet[start + ' TO ' + end]['lb']).to.equal(start); | ||
expect(rangeFacet[start + ' TO ' + end]['ub']).to.equal(end); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
['ub'] is better written in dot notation.
var rangeFacet = this.searchobj.params.ranges[rangeField]; | ||
expect(rangeFacet.hasOwnProperty(start + ' TO ' + end)).to.be.true; | ||
expect(rangeFacet[start + ' TO ' + end]['lb']).to.equal(start); | ||
expect(rangeFacet[start + ' TO ' + end]['ub']).to.equal(end); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
['ub'] is better written in dot notation.
@@ -115,6 +115,10 @@ describe('Facets', function () { | |||
this.searchobj.addRangeFilter(rangeField,start,end); | |||
expect(this.searchobj.params.ranges[rangeField][start + ' TO ' + end]) | |||
.to.exist; | |||
var rangeFacet = this.searchobj.params.ranges[rangeField]; | |||
expect(rangeFacet.hasOwnProperty(start + ' TO ' + end)).to.be.true; | |||
expect(rangeFacet[start + ' TO ' + end]['lb']).to.equal(start); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
['lb'] is better written in dot notation.
@@ -115,6 +115,10 @@ describe('Facets', function () { | |||
this.searchobj.addRangeFilter(rangeField,start,end); | |||
expect(this.searchobj.params.ranges[rangeField][start + ' TO ' + end]) | |||
.to.exist; | |||
var rangeFacet = this.searchobj.params.ranges[rangeField]; | |||
expect(rangeFacet.hasOwnProperty(start + ' TO ' + end)).to.be.true; | |||
expect(rangeFacet[start + ' TO ' + end]['lb']).to.equal(start); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
['lb'] is better written in dot notation.
f1b748d
to
9a8e4fe
Compare
9a8e4fe
to
aeecb06
Compare
@@ -1265,7 +1265,7 @@ var unbxdSearchInit = function(jQuery, Handlebars){ | |||
for(var x = 0; x < filterStrArr.length; x++){ | |||
var arr = filterStrArr[x].split(":"); | |||
if(arr.length == 2){ | |||
arr[1] = arr[1].replace(/(^")|("$)/g, '').replace(/\"{2,}/g, '"').replace(/\\\"/g, '"').replace(/(^\[)|(\]$)/g, ''); | |||
arr[1] = arr[1].replace(/(^")|("$)/g, '').replace(/\"{2,}/g, '"').replace(/\\\"/g, '"').replace(/(^\[)|(\]$)|(\}$)/g, ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this change required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Range facet in search metadata will now be in format filter: "price_fq:[30 TO 60}"
It will start with square bracket & end with flower bracket
}else if(this.params.ranges[x].hasOwnProperty(y)){ | ||
a.push(x + ':[' + this.params.ranges[x][y].lb + " TO " + this.params.ranges[x][y].ub + ']'); | ||
a.push(x + ':[' + this.params.ranges[x][y].lb + " TO " + this.params.ranges[x][y].ub + '}'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's starts with square bracket & end with flower bracket?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
square bracket -> Include interval
flower bracket -> Exclude interval
Currently we are apply filter including both upper and lower Interval. But in facets response, it returns count of products under Start >= product < End
@rahulcs @floydpraveen Please review.
handles #41